void main() {
  //Dart里面的String是一系列 UTF-16代码单元
  //1、单引号声明
  String name = 'Hello Dart!'; //单引号
  //2、双引号声明
  String title = "'Hello Dart!'"; //双引号
  //3、三引号声明大段文字(可以使单引号也可以是双引号)
  String description = """
          Hello Dart! Hello Dart!
          Hello Dart!
          Hello Dart! Hello Dart!
    """;
  //4、嵌套使用
  //单引号里面嵌套单引号，必须在前面加反斜杠
  String str3 = '双引号里面有单引号it\'s，必须在前面加反斜杠.';
  //双引号里面嵌套单引号（正常使用）
  String str4 = "双引号里面有单引号it's.";
  //单引号里面嵌套双引号（正常使用）
  String str5 = '单引号里面有双引号，编程开发初学必备语句"hello world"';
  //双引号里面嵌套双引号，必须在前面加反斜杠
  String str6 = "双引号里面有双引号，编程开发初学必备语句\"hello world\"";
  //5、${表达式}
  int value = 2;
  String result = "The result is $value";
  int width = 200;
  int height = 300;
  String square = "The square is ${width * height}";
  //6、+号拼接字符串
  String str = 'hello' + ' dart!';
  //7、转义字符，前面加‘r’表示raw字符串
  print(r"换行符：\n"); //换行符：\n
  print("换行符：\\n"); //换行符：\n
  print("换行符：\n");  //换行符：
  //8、常用方法
  String url = "https://mrale.ph/dartvm/";
  print(url.split("://")[0]); //https
  print(url.substring(3, 9)); //ps://m
  print(url.codeUnitAt(0)); //104，取当前索引位置字符的UTF-16码
  print(url.startsWith("https")); //true
  print(url.startsWith("HTTS")); //false
  print(url.endsWith("/")); //true
  print(url.toUpperCase());
  print(url.toLowerCase());
  print(url.indexOf("ph")); //14
  print(url.contains("http")); //true
  print(url.trim()); //去除字符串的首尾空格
  print(url.trimRight()); //去除字符串的右空格
  print(url.trimLeft()); //去除字符串的左空格
  print(url.length); //24,获取字符串长度
  print(url.replaceFirst("t", "A")); //替换第一次出现t字符位置的字符
  print(url.replaceAll("m", "M")); //全部替换
}
